package com.spring.bean.test;

import com.spring.bean.config.AppConfig;
import com.spring.bean.service.BeanFactoryAwareTest;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.annotation.Resource;

/**
 * 每一行代码，都是改变世界的力量
 *
 * @author 郭帅
 * @date 2022/11/29 20:10
 */

public class Main {

    @Resource
    private BeanFactoryAwareTest beanFactoryAwareTest;

    /**
     * 探索 bean 的创建方式
     */
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext(AppConfig.class);

        //
//        IPeople people = (IPeople) context.getBean("people");
//        people.say();

//        ImportDemo bean = context.getBean(ImportDemo.class);
//        bean.say();

//        ThirdMockService thirdMockService = context.getBean(ThirdMockService.class);
//        thirdMockService.mock();

//
//        ThirdMockService beanFromImportBeanDefinitionRegistrar = (ThirdMockService) context.getBean("beanFromImportBeanDefinitionRegistrar");
//        beanFromImportBeanDefinitionRegistrar.mock();

    }
}
